/*
 * @Date: 2023-03-28 17:48:11
 * @LastEditTime: 2023-03-29 18:08:20
 */
/* eslint-disable no-unused-vars */
import { createApp, onMounted, h } from 'vue';
import { createPinia } from 'pinia';
import languageCom from './language/languageSdk.vue';
// import { lazyUse } from '../src/core/use';

class languageSDK {
  constructor(options, callback) {
    if (!languageSDK.instance) {
      languageSDK.render(options, callback);
      languageSDK.instance = this;
    }
  }

  static render(options, callback) {
    if (options === void 0) {
      options = {
        el: '#app',
        appId: '',
        ability: 'language',
        success: Function,
      };
    }
    this.options = Object.assign({}, options);

    const app = createApp(languageCom);
    const pinia = createPinia();

    console.log(languageCom);

    app.use(pinia);
    // lazyUse(app);
    app.mount(this.options.el);
  }

  static init(options, callback) {
    if (!this.instance) {
      this.instance = new languageSDK(options, callback);
    }
    return this.instance;
  }
}

export default languageSDK;
